import java.io.IOException;
import java.io.PrintStream;

import groovy.lang.Binding;
import groovy.ui.InteractiveShell;

import ns.TestG;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


public class Test {

	public static final String OUT_KEY = "out";
	
	protected String imie;
	
	protected final Log log = LogFactory.getLog(this.getClass());
	
	public Test(String imie){
		this.imie = imie;
	}
	
	public void printHello(){
		System.out.println("syso java groovy " + imie);
		log.info("hello info java" + imie);
		log.debug("hello debug " + imie);
	}
	
	public static void main(String[] args) throws IOException {
		Test jakub = new Test("jakub2");
		
		(new Test("jakub")).printHello ();
		
		TestG tg = new TestG("pawelek");
		
		Binding binding = new Binding();
		
       
     //   PrintStream ps = new PrintStream(new File("/tmp/console.txt"));
        PrintStream ps = System.out;
        binding.setVariable(OUT_KEY, ps);
        binding.setVariable("jsi", jakub);
        binding.setVariable("tg", tg);
        
        InteractiveShell shell = new InteractiveShell(binding, System.in, ps, ps);
	
		shell.run();
	}

}
